#include "abstractlistmodel.h"
#include "dataobject.h"
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
int main(int argc, char *argv[]) {
    QGuiApplication app(argc, argv);
    QStringList a;
    a << "Bill Smith"
      << "John Brown"
      << "Sam Wise"; // QStringList model

    QList<QObject *> dataList; // QObject model
    dataList << new DataObject("Bill Smith", "red", "555 3264") << new DataObject("John Brown", "green", "555 8426")
             << new DataObject("Sam Wise", "blue", "555 0473") << new DataObject("Sam Wise1", "#002a1f", "555 0473");

    AbstractListModel listmodel;
    AbstractListItem *item1 = new AbstractListItem();
    item1->setName("Bill Smith");
    item1->setColor("red");
    item1->setNumber("555 3264");
    AbstractListItem *item2 = new AbstractListItem();
    item2->setName("John Brown");
    item2->setColor("green");
    item2->setNumber("555 8426");
    AbstractListItem *item3 = new AbstractListItem();
    item3->setName("Sam Wise");
    item3->setColor("blue");
    item3->setNumber("555 0473");
    AbstractListItem *item4 = new AbstractListItem();
    item4->setName("Sam Wise");
    item4->setColor("blue");
    item4->setNumber("555 0473");
    AbstractListItem *item5 = new AbstractListItem();
    item5->setName("Sam Wise");
    item5->setColor("blue");
    item5->setNumber("555 0473");
    QList<AbstractListItem *> list;
    list << item1 << item2 << item3 << item4 << item5;
    listmodel.addListItems(list);
    QQmlApplicationEngine engine;
    engine.rootContext()->setContextProperty("name1", QVariant::fromValue(a));
    engine.rootContext()->setContextProperty("myObjectModel", QVariant::fromValue(dataList));
    engine.rootContext()->setContextProperty("myModel", &listmodel);
    engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
    if (engine.rootObjects().isEmpty())
        return -1;

    return app.exec();
}
